package com.example.audit.codesec_client.whitelistDemo;

import java.util.regex.Pattern;

public class SecurityValidate {
    String username;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public void securityValidate() throws Exception {
        Pattern FILTER_PATTERN = Pattern.compile("^[a-zA-Z0-9_/\\.-]+$");
        if (!FILTER_PATTERN.matcher(username).matches()) {
            throw new Exception("用户名格式验证失败");
        }
    }
}
